Fix thread-use causing navigation polygon data corruption #93426
+52
−13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes navigation polygon data corruption caused by thread-use that changed vertices or polygons while the navigation polygon was processed, e.g. by server region sync, navmesh baking or user thread updates.
set_data()
andget_data()
in one call to avoid desync.Trio with #93392 and #93407
The NavigationPolygon has the same problematic legacy API as the NavigationMesh where it is possible to set vertices and polygon indices that are not in sync due to both using different functions with no real validation.
When user-threads were manipulating the resource there was opportunity to read the resource while another thread changed the data in the middle. This was very common in large projects when users would reuse the same navigation mesh resource and started the next update as soon as they set the navigation mesh on a region, not knowing that it takes some time for the sync to happen.